#include<stdio.h>
#include<at89c51ed2.h>
#include<mcs51reg.h>
#include<malloc.h>
#include<stdlib.h>

//#define SDA 0x40
//#define SCL 0x41

void time(int val){
	int i;
	i=0;
	while(i<val){
		val++;
	}
}
//P3.4 SCA
//P3.5 SCL
void startBit(){
	int val;
	
	/* START BIT */ 
	P3_4=1;   
	val++;		//Tsu:STA=600ns
	P3_5=0;
	val++;    //Thd:STA=600ns
	P3_4=0;
	val++;	//Tlow min = 1300 ns
	val++;
	/*END OF START BIT*/
	/*CONTROL BIT*/
	/* Sending 1*/
	P3_5=1;
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	P3_5=0; //TAA time may be an issue here
	/*Sending 0*/
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	val++;
	/* Sending 1*/
	P3_5=1;
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	P3_5=0; //TAA time may be an issue here
	
	/*Sending 0*/
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	val++;
	/*A2 A1 A0 Sequence : 0 0 0*/
	
	
	/*Sending 0*/
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	val++;
	
	/*Sending 0*/
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	val++;
	
	/*Sending 0*/
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	val++;
	
	/* READ WRITE Bit, Writing Now*/
	
	/*Sending 0*/
	val++;
	P3_4=1;
	val++;
	P3_4=0;
	val++;
	
	/*ACK Time*/
	
	
	
	
	 	
}

void dataSender(char val)
{
	int t;
	t++;
	val='i';
}
